//
//  UIImage+ColorExtension.m
//  CustomInterface
//
//  Created by tvo on 8/9/13.
//  Copyright (c) 2013 tvo. All rights reserved.
//

#import "UIImage+ColorExtension.h"

@implementation UIImage (ColorExtension)
+ (UIImage *)imageWithColor:(UIColor *)color {
    return [UIImage imageWithColor:color withSize:CGSizeMake(1, 1)];
}

+ (UIImage *)imageWithColor:(UIColor *)color withSize:(CGSize)size {
    CGRect rect = CGRectMake(0, 0, size.width, size.height);
    // Create a 1 by 1 pixel context
    UIGraphicsBeginImageContextWithOptions(rect.size, NO, 0);
    [color setFill];
    UIRectFill(rect);   // Fill it with your color
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
}


@end
